variables:
  DOCKER_DRIVER: overlay

docker-build:
  # Official docker image.
  image: gitlab/dind:latest
  stage: build
  services:
    - docker:dind
  before_script:
    - docker login $DOCKER_REGISTRY -u nologin -p $REGISTRY_KEY
  script:
    - docker build -t "$DOCKER_REGISTRY$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" --no-cache .
    - docker push "$DOCKER_REGISTRY$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
  tags:
    - main
  only:
    - "master"